home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1996 March
/
MacWorld 03:96.toast
/
Graphics
/
clip2gif 0.7.2
/
Calling clip2gif from C
/
LoadClip2Gif.h
< prev
Wrap
Text File
|
1995-12-19
|
7KB
|
253 lines
/*
* LoadClip2Gif.h
*
* Copyright 1995, Yves Piguet. All right reserved.
*
* Definitions and prototypes to use clip2gif as a library.
*/
#ifndef __LoadClip2Gif__
#define __LoadClip2Gif__
#include <Types.h>
#include <Files.h>
#ifndef colorPaletteSystem
#define colorPaletteSystem ((CTabHandle)0)
#define colorPaletteGrayScale ((CTabHandle)-1)
#define colorPaletteCustom ((CTabHandle)-2)
#endif
#ifndef transparencyNo
#define transparencyNo ((RGBColor *)0)
#define transparencyWhite ((RGBColor *)-1)
#define transparencyFirstPixel ((RGBColor *)-2)
#endif
#ifndef errNotGifFile
#define errNotGifFile -20100
#define errBadGifFile -20101
#define errNoGifDecoder -20102
#endif
#ifndef errUnknownFileType
#define errUnknownFileType -20018
#endif
typedef struct
{
PixMapHandle pixmap; // only this field is public
long private[3];
} Offscreen;
/*
* err = LoadClip2Gif(void)
*
* Description:
*
* Loads clip2gif and resolves symbols. clip2gif should be on the same volume as
* the calling program.
*/
OSErr LoadClip2Gif(void);
/*
* Defined functions:
* ==================
*
* version = GetVersionNumber();
*
* Description:
*
* Returns the version number of clip2gif (e.g. 71 for 0.7.1).
* Allows to check that it's the correct one.
*
* -----
*
* err = BeginOffscreen(&os, width, height, depth, clut);
*
* Description:
*
* Allocates a new offscreen pixmap, erases it and sets the GrafPort
*
* Parameters:
*
* Offscreen os new offscreen data (initialized by BeginOffscreen)
* short width offscreen width
* short height offscreen height
* short depth offscreen depth (should be 1, 2, 4 or 8 if used with
* ConvertPixmapTo... later)
* CTabHandle clut color lookup table, or colorPaletteSystem or colorPaletteGrayScale
* (NOT colorPaletteCustom)
*
* -----
*
* err = DisposeOffscreen(&os);
*
* Description:
*
* Disposes an offscreen allocated by BeginOffscreen and restores the old GrafPort
*
* Parameters:
*
* Offscreen os offscreen data
*
* -----
*
* err = ConvertPictToGIFHandle(thePic, gifHandle, interlaced, transparency, depth, colors);
*
* Description:
*
* Converts a pict to a GIF handle
*
* Parameters:
*
* OSErr err noErr if successful, error code otherwise
* PicHandle thePic input picture
* Handle gifHandle output GIF handle (a new handle is allocated)
* short interlaced 0 if the GIF scanlines are not interlaced, 1 if they are
* RGBColor *transparency
* one of the magic values defined above, or transparent color
* short depth number of bits per pixel (1, 2, 4 or 8)
* CTabHandle clut: color lookup table, or colorPaletteSystem,
* colorPaletteGrayScale or colorPaletteCustom
*
* -----
*
* err = ConvertPictToGIFFile(thePic, gifFile, interlaced, transparency, depth, colors);
*
* Description:
*
* Converts a pict to a GIF file
*
* Parameters:
*
* OSErr err noErr if successful, error code otherwise
* PicHandle thePic input picture
* FSSpec *gifFile output GIF file
* short interlaced 0 if the GIF scanlines are not interlaced, 1 if they are
* RGBColor *transparency
* one of the magic values defined above, or transparent color
* short depth number of bits per pixel (1, 2, 4 or 8)
* CTabHandle clut: color lookup table, or colorPaletteSystem,
* colorPaletteGrayScale or colorPaletteCustom
*
* -----
*
* err = ConvertFileToPict(theFile, &thePic);
*
* Description:
*
* Reads a PICT, GIF, TIFF or JPEG file and stores it into a PicHandle
*
* Parameters:
*
* OSErr err noErr if successful, error code otherwise
* FSSpec *theFile input file
* PicHandle thePic output picture
*
* -----
*
* err = ConvertPictToTIFFHandle(thePic, tiffHandle, depth, bigEndian);
*
* Purpose:
*
* Converts a pict to a TIFF handle
*
* Parameters:
*
* OSErr err noErr if successful, error code otherwise
* PicHandle thePic input picture
* Handle tiffHandle output TIFF Handle
* short depth number of bits per pixel (16 or 32)
* short bigEndian 0 for little endian (Transputers and others),
* 1 for big endian (Motorola, SPARC, etc.)
*
* -----
*
* err = ConvertPictToTIFFFile(thePic, tiffFile, depth, bigEndian);
*
* Purpose:
*
* Converts a pict to a TIFF file
*
* Parameters:
*
* OSErr err noErr if successful, error code otherwise
* PicHandle thePic input picture
* FSSpec tiffFile output TIFF FSSpec
* short depth number of bits per pixel (16 or 32)
* short bigEndian 0 for little endian (Transputers and others),
* 1 for big endian (Motorola, SPARC, etc.)
*
* -----
*
* err = ConvertPictToJPEGHandle(thePic, jpegHandle, depth, quality);
*
* Purpose:
*
* Converts a pict to a JPEG handle
*
* Parameters:
*
* OSErr err noErr if successful, error code otherwise
* PicHandle thePic input picture
* Handle jpegHandle output JPEG handle (a new handle is allocated)
* short depth number of bits per pixel (16 or 32)
* short quality JPEG compression quality (0 = bad, 4 = very good)
*
* -----
*
* err = ConvertPictToJPEGFile(thePic, jpegFile, depth, quality);
*
* Purpose:
*
* Converts a pict to a JPEG file
*
* Parameters:
*
* OSErr err noErr if successful, error code otherwise
* PicHandle thePic input picture
* FSSpec jpegFile output JPEG FSSpec
* short depth number of bits per pixel (16 or 32)
* short quality JPEG compression quality (0 = bad, 4 = very good)
*
* -----
*
* err = GetScreen(&crop, &thePic)
*
* Description:
*
* Converts a rectangular piece of the screen into a PicHandle
*
* Parameters:
*
* OSErr err noErr if successful, error code otherwise
* Rect crop cropping rectangle in global coordinates (full screen if null)
* PicHandle thePic output picture
*/
/*
* CFM stuff
*/
extern short (*GetVersionNumber)(void);
extern OSErr (*BeginOffscreen)(Offscreen *, short, short, short, CTabHandle);
extern OSErr (*DisposeOffscreen)(Offscreen *);
extern OSErr (*ConvertFileToPict)(PicHandle, Handle *);
extern OSErr (*ConvertPictToGIFFile)(PicHandle, FSSpec *, short, RGBColor *, short, CTabHandle);
extern OSErr (*ConvertPictToGIFHandle)(PicHandle, Handle *, short, RGBColor *, short, CTabHandle);
extern OSErr (*ConvertPixmapToGIFHandle)(PixMapHandle, Handle *, short, RGBColor *);
extern OSErr (*ConvertPixmapToGIFFile)(PixMapHandle, FSSpec *, short, RGBColor *);
extern OSErr (*ConvertPictToJPEGHandle)(PicHandle, Handle *, short, short);
extern OSErr (*ConvertPictToJPEGFile)(PicHandle, FSSpec *, short, short);
extern OSErr (*ConvertPictToTIFFHandle)(PicHandle, Handle *, short, short);
extern OSErr (*ConvertPictToTIFFFile)(PicHandle, FSSpec *, short, short);
extern OSErr (*GetScreen)(Rect *, PicHandle *);
#endif